package com.ysd.lis.controller.sys;


import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.SysBasDictType;
import com.ysd.lis.request.CommonPageDto;
import com.ysd.lis.service.SysBasDictTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 员工表
 * 前端控制器
 * </p>
 *
 * @author LiuQi
 * @since 2023-10-19
 */
@Api(tags = "基础字典分类")
@RestController
@RequestMapping("/api/sys/basDictType")
public class SysBasDictTypeController extends BaseController {
    @Autowired
    SysBasDictTypeService sysBasDictTypeService;

    @PostMapping("/addDictType")
    @LogDetail(requestParam ="addDictType",operationType = OperationType.INSERT, module = "字典设计",content = "通过字典分类列表树，增加【name】树节点", businessName = "name")
    public Result addDictType(@RequestBody SysBasDictType sysBasDictType){
        return sysBasDictTypeService.addDictType(sysBasDictType);
    }

    @PostMapping("/editDictType")
    @LogDetail(requestParam ="editDictType",operationType = OperationType.UPDATE, module = "字典设计",content = "通过字典分类列表树，编辑【name】树节点", businessName = "name")
    public Result editDictType(@RequestBody SysBasDictType sysBasDictType){
        return sysBasDictTypeService.editDictType(sysBasDictType);
    }
    @PostMapping("/deletDictType")
    @LogDetail(requestParam ="deletDictType",operationType = OperationType.DELETE, module = "字典设计",content = "通过字典分类列表树模块，删除【name】数据", businessName = "name")
    public Result deletDictType(@RequestBody SysBasDictType sysBasDictType){
        return sysBasDictTypeService.deletDictType(sysBasDictType);
    }


    @ApiOperation("查询字典分类树形结构")
    @GetMapping("/findDictTypeTree")
    public Result findDictTypeTree(CommonPageDto pageParam){
        return sysBasDictTypeService.findDictTypeTree(pageParam);
    }

}
